{extend name="common:base" /}


{block name="breadcrumb"}
<h1>
    系统配置
    <small>系统配置</small>
</h1>
<ol class="breadcrumb">
    <li><a href="{:url('/admin')}"><i class="fa fa-dashboard"></i> 控制台</a></li>
    <li class="active">系统配置</li>
</ol>
{/block}


{block name="content"}
<!-- Default box -->
<div class="row">
    <div class="col-md-12">
        <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#settings" data-toggle="tab">网站配置</a></li>
                <li><a href="#timeline" data-toggle="tab">SEO配置</a></li>
                <li><a href="#activity" data-toggle="tab">其他配置</a></li>
            </ul>
            <div class="tab-content">
                <div class="active tab-pane" id="settings">
                    <form action="{:url('/admin/system_setting/save')}" method="post" id="formDocument" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">网站名称</label>
                            <div class="col-sm-10">
                                <input type="text" name="site_name" class="form-control" id="inputSiteName" placeholder="网站名称" value="{$info.site_name|default=''}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">网站LOGO</label>
                            <div class="col-sm-10 upload-box">
                                <img class="upload-box-img" src="{$info.site_logo|default='/static/admin/dist/img/upload-pic.png'}">
                                <input class="upload-box-input" type="hidden" name="site_logo" value="{$info.site_logo}">
                                <input class="upload-input" type="file" id="file" name="file">
                            </div>
                            <p class="help-block">选择一张图片作为Logo.</p>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">邮箱</label>
                            <div class="col-sm-10">
                                <input type="email" name="site_email" class="form-control" id="inputSiteEmail" placeholder="网站邮箱" value="{$info.site_email|default=''}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">QQ</label>
                            <div class="col-sm-10">
                                <input type="text" name="site_qq" class="form-control" id="inputSiteQq" placeholder="QQ" value="{$info.site_qq|default=''}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">电话</label>
                            <div class="col-sm-10">
                                <input type="text" name="site_tel" class="form-control" id="inputSiteTel" placeholder="电话" value="{$info.site_tel|default=''}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">联系我们</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" name="site_contact_us" id="inputSiteContactUs" placeholder="联系我们">{$info.site_contact_us|default=''}</textarea>
                                <p class="help-block">注意添加换行< / b r ></p>
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">地址</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" name="site_address" id="inputSiteAddress" placeholder="地址">{$info.site_address|default=''}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">版权</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" name="site_copyright" id="inputSiteCopyright" placeholder="版权">{$info.site_copyright|default=''}</textarea>
                            </div>
                        </div>


                        <!--<div class="form-group">-->
                        <!--<div class="col-sm-offset-2 col-sm-10">-->
                        <!--<div class="checkbox">-->
                        <!--<label>-->
                        <!--<input type="checkbox"> 我同意 <a href="#">网站协议</a>-->
                        <!--</label>-->
                        <!--</div>-->
                        <!--</div>-->
                        <!--</div>-->
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-danger">修改</button>
                            </div>
                        </div>
                    </form>
                </div>
                <!-- /.tab-pane -->
                <div class="tab-pane" id="activity">

                </div>
                <!-- /.tab-pane -->
                <div class="tab-pane" id="timeline">

                </div>
                <!-- /.tab-pane -->


            </div>
            <!-- /.tab-content -->
        </div>
        <!-- /.nav-tabs-custom -->
    </div>
</div>
<!-- /.box -->
{/block}
{block name="js"}
<script src="/static/admin/dist/js/ajaxfileupload.js"></script>
<script>
    $("#formDocument").validate();
    $('.upload-input').change(function () {
        var pDom = $(this).parent();
        $.ajaxFileUpload({
            url: '/admin/upload', //用于文件上传的服务器端请求地址
            secureuri: false, //是否需要安全协议，一般设置为false
            fileElementId: 'file', //文件上传域的ID
            dataType: 'json', //返回值类型 一般设置为json
            success: function (data, status) {
                var path = data.file_path;
                //console.log(_this.parent());
                pDom.find('img.upload-box-img').attr('src',path);
                pDom.find('input.upload-box-input').val(path);
            },
            error: function (data, status, e) {
                alert(e);
            }
        })
    });
</script>
{/block}